package com.bjpowernode.dataservice.mapper;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AccountMapper {

    @Update(" update u_finance_account set available_money=available_money-#{money} " +
            " where uid=#{userId} and available_money>=#{money}")
    int updateBalance(Long userId, Double money);

    @Select("select available_money from u_finance_account where uid=#{id}")
    Double getBalance(Long id);

    @Update("update u_finance_account set available_money=available_money+#{money} where uid=#{uid}")
    void addBalance(Long uid, Double money);
}
